#!/usr/bin/env python3
"""
应用启动脚本
"""

import os
import sys
from pathlib import Path

# 添加项目根目录到Python路径
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))

def main():
    """主函数"""
    print("🚀 启动离线语言播放系统...")
    
    try:
        import uvicorn
        
        # 启动服务器
        uvicorn.run(
            "app.main:create_app",
            host="0.0.0.0",
            port=8000,
            reload=True,
            log_level="info",
            factory=True
        )
        
    except ImportError as e:
        print(f"❌ 导入错误: {e}")
        print("💡 请确保已安装所有依赖:")
        print("   pip install -r requirements.txt")
    except Exception as e:
        print(f"❌ 启动失败: {e}")

if __name__ == "__main__":
    main()
